Skip to content

Fix MQTT eventing and upgrade Moquette#1035

Merged
aaronzi merged 1 commit into
eclipse-basyx:mainfrom
aaronzi:fix/mqtt-eventing-moquette-upgrade
Jul 19, 2026
Merged

Fix MQTT eventing and upgrade Moquette#1035
aaronzi merged 1 commit into
eclipse-basyx:mainfrom
aaronzi:fix/mqtt-eventing-moquette-upgrade

Conversation

@aaronzi

@aaronzi aaronzi commented Jul 19, 2026

Copy link
Copy Markdown
Member

Description of Changes

This makes MQTT eventing consistent across the AAS Repository, AAS Service, Submodel Repository, and Submodel Service.

Identifiers in topic paths now use unpadded UTF-8 Base64URL encoding. Full element replacements and $value patches use distinct topics, and the Submodel Service emits the missing bulk patch and attachment events. Nested element creation now publishes the actual child path and payload for both collections and lists. Configured repository names are preserved through all Submodel Repository decorators.

The duplicated MQTT client and publishing setup is shared through MQTT core. Moquette is updated to 0.17 and kept in test scope. The shared broker fixture waits for Moquette's actual ephemeral ports, uses a bounded event queue, tracks asynchronous broker failures, closes all clients before shutdown, and covers concurrent publication plus WebSocket and authenticated connections.

Docker publication is fail-closed and only enabled for eclipse-basyx/basyx-java-server-sdk when the repository is not a fork. A small workflow test covers upstream, fork, renamed repository, and missing-metadata cases.

Related Issue

Closes #984
Closes #768
Closes #994
Closes #627

MQTT Event Compatibility

This is a canonical-only migration. There is no legacy or dual publication, so subscribers using a changed topic need to update their subscriptions.

Existing events with changed topics or corrected behavior:

  • AAS Repository submodel-reference create/delete topics now Base64URL-encode the referenced submodel ID instead of using it verbatim.
  • AAS Service topics now Base64URL-encode the shell ID instead of URL-percent-encoding it.
  • Submodel Repository $value PATCH events move from .../{idShortPath}/updated to .../{idShortPath}/value/updated. Full element PUT remains on .../{idShortPath}/updated.
  • Submodel Service element topics now include the encoded submodel ID: sm-service/submodels/{submodelId}/submodelElements/.... Its $value PATCH events also use .../value/updated.
  • Submodel Repository nested-create events now contain the created child path and payload. Previously they incorrectly published the parent path and parent payload.
  • Submodel Service nested creates now complete successfully and emit the child event. Previously the child was created, but event lookup used a root-level path and could throw without publishing.
  • With repository decorators enabled, a configured Submodel Repository name now replaces the accidental sm-repo segment in emitted topics.

New events:

  • Submodel Service bulk element patch: .../submodelElements/patched.
  • Submodel Service attachment update/delete: .../{idShortPath}/attachment/updated and .../{idShortPath}/attachment/deleted.

Unchanged event contracts include AAS Repository shell CRUD, Submodel Repository submodel CRUD, full element replacement, element deletion, bulk patch, and attachment events, apart from the repository-name correction described above. Existing JSON payload schemas are unchanged except for the nested-create correction from parent payload to child payload.

The public MqttSubmodelServiceTopicFactory create/update/delete methods now require a submodelId; direct Java callers of those methods need to update. General encoder APIs and feature-specific configuration entry points remain available.

BaSyx Configuration for Testing

No special BaSyx configuration is required. The MQTT tests start an embedded Moquette broker with persistence and telemetry disabled.

AAS Files Used for Testing

None. The tests create their AAS and submodel fixtures directly.

Additional Information

The MQTT core and all four MQTT feature suites pass, including collection/list nested-create regression tests and a 100-event concurrent stress case. The focused reactor also passed three times with Maven -T 4 parallelism. Anonymous/authenticated TCP, rejected credentials, WebSocket connections, broker error propagation, bounded queue handling, and client cleanup are covered.

The Docker guard behavior tests and workflow YAML checks pass. Runtime dependency checks contain no Moquette; Moquette 0.17 is test-only and reload4j is excluded. New source, test, workflow, and script files use the repository's full MIT license header.

A full reactor run still reaches existing tests that require external token and Kafka services; those failures are unrelated to this change.

@aaronzi
aaronzi marked this pull request as ready for review July 19, 2026 16:34
Unify MQTT topics, upgrade Moquette, and guard Docker publishing.
@aaronzi
aaronzi force-pushed the fix/mqtt-eventing-moquette-upgrade branch from 2e9b45f to 78da2f2 Compare July 19, 2026 17:07
@aaronzi
aaronzi merged commit d8496d7 into eclipse-basyx:main Jul 19, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment